package lesson;

import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;

import java.io.IOException;

public class FindDom {
    public static void main(String[] args) throws IOException {
        Document document = Jsoup.connect("http://127.0.0.1:8848/jsoup/finddom.html").get();
       // Element mydiv3 = document.getElementById("mydiv3");
        Element mydiv3 = document.selectFirst("#mydiv3");
        System.out.println(mydiv3.text());
        //mydiv3.style.color = "red";
        Elements allH1 = document.getElementsByTag("h1");
        //console.log(allH1.length);
        System.out.println(allH1.size());
        Elements allClass1 = document.getElementsByClass("myClass1");
        System.out.println(allClass1.size());

        System.out.println( allH1.get(0).text());
        allH1.get(0).text("11111111111111");
        System.out.println( allH1.get(0).text());
    }
}
